<template>
  <div class="box">
    <div v-for="item in list" :key="item.id">
      <a class="relax-item" target="_blank" :href="item.link">
        <fish>
          <img :src="item.logo" alt="" class="fish-eye">
          <div class="game-info">
            <div class="game-title">{{ item.title }}</div>
            <div class="game-desc">{{ item.desc }}</div>
          </div>
        </fish>
      </a>
    </div>

    <!-- 气泡 -->
    <div class="bubble" v-for="bubble in 30" :key="bubble" :class="`b${bubble}`"></div>
  </div>
</template>


<script setup name="Relax">
import fish from "./components/fish.vue";
import { onMounted, ref } from 'vue';

const list = ref([
  {
    id:'网页开车',
    link:'https://bruno-simon.com/',
    logo:'https://www.autopiano.cn/favicon.ico',
    title:'网页开车',
    desc:'控制模拟的遥控车在地图上随意行驶，十分解压',
  },
])

onMounted(() => {})
</script>

<style lang="scss" scoped>
$--footerHeight: 160px;
.box {
  position: relative;
  width: 100%;
  height: fit-content;
  padding-bottom: calc($--footerHeight + 20px);
  background: linear-gradient(#29B6F6, #0D47A1, #1A237E);

  &::-webkit-scrollbar {
    display: none;
  }
}

@keyframes shake {
  10%,90% {
    transform: translate3d(2px,0,0) scale(.95);
  }
  20%,80% {
    transform: translate3d(3px,0,0) scale(.95);
  }
  30%,70% {
    transform: translate3d(-5px,0,0) scale(.95);
  }
  40%,60% {
    transform: translate3d(5px,0,0) scale(.95);
  }
  50% {
    transform: translate3d(-5px,0,0) scale(.95);
  }
}
@keyframes fish{
  100%{
    transform: scaleY(.94);
  }
}
.relax-item {
  position: relative;
  z-index: 1;
  width: 200px;
  height: 104px;
  padding: 10px;
  margin: 12px 50px 0 12px;
  border-radius: 6px;
  transition: all .3s;
  display: flex;
  align-items: center;
  cursor: -webkit-grab;
  animation: fish 1s linear infinite alternate;

  &:hover {
    transform: scale(.95);
    animation: shake .6s linear infinite;
    &:before{
      content: '啊啊啊，放开我～';
      position: absolute;
      top: -10px;
      right: -10px;
      z-index: 3;
      color: #333;
      padding: 8px 12px;
      background: #fff;
      border-radius: 4px;
    }
    .fish-eye{
      border-width: 5px;
    }
  }

  .fish-eye {
    position: relative;
    width: 25px;
    height: 25px;
    margin-left: 10px;
    border-radius: 50%;
    object-fit: cover;
    overflow: hidden;
    margin-right: 10px;
    border: 2px solid #2a1f17;
  }

  .game-info {
    flex: 1;
    padding-right: 10px;

    .game-title {
      font-size: 14px;
      font-weight: 700;
      color: #3273dc;
      text-overflow: ellipsis;
      white-space: nowrap;
      padding: 0 0.1rem;
    }

    .game-desc {
      color: gray;
      font-size: 12px;
      height: 30px;
      word-break: break-all;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      margin-top: 2px;
    }
  }
}

.bubble {
  position: absolute;
  bottom: 0;
  z-index: 1;
  background-color: #4DD0E1;
  height: 20px;
  width: 20px;
  min-width: 10px;
  min-height: 10px;
  border-radius: 50%;
  box-shadow: inset -2px -3px #00BCD4, 1px 3px rgba(0, 0, 0, .1);
  opacity: 0;
  pointer-events: none;

  &::before {
    content: '';
    position: absolute;
    background-color: transparent;
    width: 50%;
    height: 50%;
    border: 3px solid #fff;
    border-radius: 50%;
    border-top: solid 3px transparent;
    border-right: solid 3px transparent;
    border-bottom: solid 3px transparent;
    transform: rotate(45deg);
    opacity: .6;
    top: 2px;
    left: 2px;
  }
}

@for $i from 1 through 30 {
  .b#{$i} {
    $--radius: random(20)+10+px;
    width: $--radius;
    height: $--radius;
    left: (random(1600)) + px;
    bottom: (random(100)) + px;
    animation: bubble- + (random(3)) 12s infinite linear;
    animation-delay: random(12) + s;
  }
}

@keyframes bubble-1 {
  0% {
    opacity: 1;
    transform: translateY(0px);
  }

  100% {
    transform: translateY(-100vh) translateX(200px);
  }
}

@keyframes bubble-2 {
  0% {
    opacity: 1;
    transform: translateY(0px);
  }

  100% {
    transform: translateY(-100vh) translateX(-50px);
  }
}

@keyframes bubble-3 {
  0% {
    opacity: 1;
    transform: translateY(0px);
  }

  100% {
    transform: translateY(-100vh) translateX(60px);
  }
}

@media (max-width: 480px) {
  .box{
    justify-content: center;
    .relax-item{
      margin: 5px 0;
    }
  }
}
</style>